<?php
/**
 * Description of NavMenuModule
 * 网站后台目录管理
 * @author
 */
class NavMenuModule extends BaseModule {

    /**
     * 目录数组
     *
     * @return array
     */
    public static function directory() {
        $menus = array(
            1 => array('title' => '系统管理',
                'type' => '1',
                'sub_title' => array(
                    array('title' => '网站域名', 'url' => 'webDomin/config/')
                ),
                'module_key' => '1'
            ),
            2 => array('title' => '用户管理',
                'type' => '2',
                'sub_title' => array(
                    array('title' => '查看用户', 'url' => 'managing/selUserList/'),
                    array('title' => '添加用户', 'url' => 'managing/addUser/'),
                    array('title' => '批量导入', 'url' => 'managing/BulkImport/')
                ),
                'module_key' => '2'
            ),
            3 => array('title' => '配置管理',
                'type' => '3',
                'sub_title' => array(
                    array('title' => '配置文件', 'url' => 'systemConfig/edit/')
                ),
                'module_key' => '3'
            ),
            4 => array('title' => '系统安全设置',
                'type' => '4',
                'sub_title' => array(
                    array('title' => 'IP限制', 'url' => 'system/listip/'),
                    array('title' => '密码复杂度', 'url' => 'system/setpwd/'),
                    array('title' => '用户访问管理', 'url' => 'system/pwdExpirationTime/') //包括登录失败次数,密码过期天数,锁定用户账户时间,用户无操作过期时间
                ),
                'module_key' => '4'
            ),
            5 => array('title' => '用户管理',
                'type' => '5',
                'sub_title' => array(
                    array('title' => '用户授权', 'url' => 'user/userList/'),
                    //array('title' => '解锁管理员用户', 'url' => 'audit/userListAudit/')
                ),
                'module_key' => '5'
            ),
            6 => array('title' => '系统日志管理',
                'type' => '6',
                'sub_title' => array(
//                    array('title' => '日志溢出条数设置', 'url' => 'logShowListMore/setLogMaxCount/'),
					array('title' => '刻录日志', 'url' => 'logShowListMore/record/'),
                    array('title' => '申请流程日志', 'url' => 'logShowListMore/request/'),
                    array('title' => '文件交换日志', 'url' => 'logShowListMore/filerecv/'),
					array('title' => 'audit管理员登陆日志', 'url' => 'logShowListMore/adminLoginAudit/'),
					array('title' => 'audit管理员操作日志', 'url' => 'logShowListMore/auditAudit/'),
					array('title' => '用户登录日志', 'url' => 'logShowListMore/userLogin/'),
                ),
                'module_key' => '6'
            ),
            7 => array('title' => '日志管理',
                'type' => '7',
                'sub_title' => array(
                    array('title' => '管理员登陆日志', 'url' => 'logShowList/adminLogin/'),
                    array('title' => '账号维护日志', 'url' => 'logShowList/adminModify/'),
                    array('title' => '管理员操作日志', 'url' => 'logShowList/operation/'),
                    array('title' => '日志导出记录', 'url' => 'logShowList/downLog/')
                ),
                'module_key' => '7'
            ),
            8 => array('title' => '管理员管理',
                'type' => '8',
                'sub_title' => array(
                    array('title' => '管理员查看', 'url' => 'createadmin/adminList/'),
                ),
                'module_key' => '8'
            ),
            9 => array('title' => '个人密码修改',
                'type' => '9',
                'sub_title' => array(
                    array('title' => '密码修改', 'url' => 'updatepwd/upPwd/')
                ),
                'module_key' => '9'
            ),
            10 => array('title' => '审批管理',
                'type' => '10',
                'sub_title' => array(
                    array('title' => '审批策略管理', 'url' => 'examination/strategylist/'),
                    array('title' => '审批流程管理', 'url' => 'examination/batchList/'),
                ),
                'module_key' => '10'
            ),
            11 => array('title' => '部门管理',
                'type' => '11',
                'sub_title' => array(
                    array('title' => '部门管理', 'url' => 'depart/departmentList/')
                ),
                'module_key' => '11'
            ),
        );
        return $menus;
    }

    /**
     * 根据用户权限显示相应的目录
     *
     * @param str $root 该用户的权限
     * @param str $type 二级菜单显示权限
     * @return array
     */
     public static function get_user_menu($root) {
        $directory = self::directory();
        if($root == 0){
             $user_test=$directory;
             return $user_test;
        }else{
            $k=trim($root,',');
            if(strrpos($root, ",") !== false ){
                 $rowtype = explode(",", $k);
            }
        }
        $user_text = array();
            if(is_array($rowtype)){
                 foreach ($rowtype as $val) {
                    $user_text[$val] = $directory[$val];
                }
            }else{
               $user_text[$k] = $directory[$k];
            }
           return $user_text;
        }

}

?>
